package com.wtf.controller;

import com.wtf.service.CodeService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author tengfei wang
 * @version 1.0
 * @date Created in 2020/11/2
 */
@RestController
@RequestMapping("/code")
public class CodeController {

    @Resource
    private CodeService codeService;


    @RequestMapping("/create/{email}")
    public boolean createCode(@PathVariable("email")String email) {
        return codeService.createCode(email);
    }

    @RequestMapping("/validate/{email}/{code}")
    public Integer validCode(@PathVariable("email")String email, @PathVariable("code")Integer code) {
        return codeService.validCode(email, code);
    }
}
